import { createApp } from 'vue';
import Schema from 'async-validator';

// global css
import 'uno.css';
import '@/assets/styles/index.scss';
import 'element-plus/theme-chalk/dark/css-vars.css';

// App、router、store
import App from './App.vue';
import store from './store';
import router from './router';

// 注册插件
import plugins from './plugins/index'; // plugins

// 预设动画
import animate from './animate';

// svg图标
import 'virtual:svg-icons-register';
import ElementIcons from '@/plugins/svgicon';

// permission control
import './permission';

import { parseTime, addDateRange, handleTree } from '@/utils/ruoyi';

Schema.messages.required = (fieldName) => {
	return '该项为必填项';
};

const app = createApp(App);
// 全局方法挂载
app.config.globalProperties.parseTime = parseTime;
app.config.globalProperties.handleTree = handleTree;
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.animate = animate;

app.use(ElementIcons);
app.use(router);
app.use(store);
app.use(plugins);

app.mount('#app');
